{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Blending Craft Beer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem Definition\n", "\n", "Duff Beer is an american brewery that sells alcoholic beverages worldwide. Duff beer has a very large market share in the US. One of the new business lines of Duff Beer is in the craft beer sector. Duff beer buys 3 types of wort from local suppliers. The availability of wort (in liters) and the price for each of them is specified in Table 1. \n", "\n", "**Table 1:** daily availability and cost of wort\n", "\n", "| Wort | Availability (liters) | Cost (€cents/liter) | \n", "|--------|-----------------------|---------------------|\n", "| Type 1 | 2500 | 120 |\n", "| Type 2 | 1200 | 095 |\n", "| Type 3 | 2000 | 150 |\n", "\n", "The blend of the three types of wort must comply with the following quality requirements: \n", "\n", "- For Beer Angels, no less than 60% of Type 3 and no more of 20% of Type 2. The price of one bottle of Beer Angel is 4.10€s/liter. \n", "\n", "- For Beer Beast, no less than 15% of Type 3 and no more than 60% of Type 2. The price of one bottle of Beer Beast is 2.80€s/liter.\n", "\n", "- For Beer Cactus, no more than 50% of type 2. The selling price is 2.45€/liter.\n", "\n", "**Write a linear program to find the most profitable blend of wort to elaborate the three kinds of beers**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem Model\n", "### Indices\n", "We can define the following indices to express the problem in a compact form:\n", "- i: wort type $i \\in [1, 2, 3]$\n", "- j: Beer brand $j \\in [A, B, C]$ where A notes Angels, B notes Beast, and C notes Cactus\n", "\n", "### Decision variables\n", "The decision variables are: \n", "\n", "$x_{ij}$: Amount of wort of type i (1, 2, 3) in Beer j: A (Angels), B (Beast), C (Cactus), (ie i=[1,2,3], j=[A,B,C])\n", "\n", "\n", "### Objective Function\n", "The objective function is:\n", "\n", "$\\max z = \\sum_{i=1}^{3}\\sum_{j=A}^{C}(d_j - c_i)*x_{ij}$\n", "\n", "where $d_j$ is the selling price of a bottle of beer j and $c_i$ is the cost per liter of wort type i.\n", "\n", "$\\max z =4 10(x_{1A}+x_{2A}+x_{3A})+280(x_{1B}+x_{2B}+x_{3B})+245(x_{1C}+x_{2C}+x_{3C})-120(x_{1A}+x_{1B}+x_{1C})-95(x_{2A}+x_{2B}+x_{2C})-150(x_{3A}+x_{3B}+x_{3C})$\n", "\n", "$\\max z = 290x_{1A}+315x_{2A}+260x_{3A}+160x_{1B}+185x_{2B}+130x_{3B}+125x_{1C}+150x_{2C}+95x_{3C}$\n", "\n", "\n", "### Constraints\n", "Subject to the following constraints:\n", "\n", "**Availability constraints**\n", "The availability constraints can be expressed in a compact form as: \n", "\n", "$\\sum_jx_{ij} \\leq a_i \\forall i$ \n", "\n", "Where $a_i$ is the availability of wort type i:\n", "\n", "$x_{1A}+x_{1B}+x_{1C} \\leq 2500$ \n", "\n", "$x_{2A}+x_{2B}+x_{2C} \\leq 1200$\n", "\n", "$x_{3A}+x_{3B}+x_{3C} \\leq 2000$\n", "\n", "**Quality constraints**\n", "The proportion of a given type of wort i' in a type of beer j' can be expressed as:\n", "\n", "$\\frac{x_{i'j'}}{\\sum_i(x_{ij'})} \\forall i', j'$\n", "\n", "If we compare this to the minimum proportion $R_{min_{i'j'}}$ we obtain:\n", " \n", "$\\frac{x_{i'j'}}{\\sum_i(x_{ij'})} \\geq R_{min_{i'j'}} \\forall i', j'$\n", "\n", "Or \n", "\n", "$x_{i'j'} \\geq R_{min_{i'j'}}*\\sum_i(x_{ij'}) \\forall i', j'$\n", "\n", "If we take the denominator to the RHS.\n", "We can obtain a similar expression for the maximum proportion $R_{max_{i'j'}}$:\n", "\n", "$x_{i'j'} \\geq R_{max_{i'j'}}*\\sum_i(x_{ij'}) \\forall i', j'$\n", "\n", "From these expressions, we can derive the constraints for every type of beer: \n", "\n", "**Angels quality requirement constraints**\n", "\n", "$x_{3A} \\geq 0.6(x_{1A}+x_{2A}+x_{3A})$\n", "\n", "$x_{2A} \\leq 0.2(x_{1A}+x_{2A}+x_{3A})$\n", "\n", "Beast quality requirement constraints\n", "\n", "$x_{3B} \\geq 0.15(x_{1B}+x_{2B}+x_{3B})$\n", "\n", "$x_{2B} \\leq 0.6(x_{1B}+x_{2B}+x_{3B})$\n", "\n", "Cactus quality requirement constraints\n", "\n", "$x_{2C} \\leq 0.5(x_{1C}+x_{2C}+x_{3C})$" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "pycharm": { "stem_cell": { "cell_type": "raw", "source": [], "metadata": { "collapsed": false } } } }, "nbformat": 4, "nbformat_minor": 1 }